//header的悬停事件

var dt_bav_btn12 = document.querySelector("#dt_nav_btn12");
var dt_bav_content12 = document.querySelector("#dt_nav_content12");


dt_bav_btn12.addEventListener("mouseover",function(){
    dt_bav_content12.style.display = "block";
});

dt_bav_btn12.addEventListener("mouseleave",function(){
    dt_bav_content12.style.display = "none";
});

dt_bav_content12.addEventListener("mouseover",function(){
    dt_bav_content12.style.display = "block";
});

dt_bav_content12.addEventListener("mouseleave",function(){
    dt_bav_content12.style.display = "none";
});




var dt_bav_btn13 = document.querySelector("#dt_nav_btn13");
var dt_bav_content13 = document.querySelector("#dt_nav_content13");


dt_bav_btn13.addEventListener("mouseover",function(){
    dt_bav_content13.style.display = "block";
});

dt_bav_btn13.addEventListener("mouseleave",function(){
    dt_bav_content13.style.display = "none";
});

dt_bav_content13.addEventListener("mouseover",function(){
    dt_bav_content13.style.display = "block";
});

dt_bav_content13.addEventListener("mouseleave",function() {
    dt_bav_content13.style.display = "none";

});



//nav的悬停事件
var dt_bav_btn = document.querySelector("#dt_nav_btn");
var dt_bav_content = document.querySelector("#dt_nav_content");


dt_bav_btn.addEventListener("mouseover",function(){
    dt_bav_content.style.display = "block";
});

dt_bav_btn.addEventListener("mouseleave",function(){
    dt_bav_content.style.display = "none";
});

dt_bav_content.addEventListener("mouseover",function(){
    dt_bav_content.style.display = "block";
});

dt_bav_content.addEventListener("mouseleave",function(){
    dt_bav_content.style.display = "none";
});



var dt_bav_btn1 = document.querySelector("#dt_nav_btn1");
var dt_bav_content1 = document.querySelector("#dt_nav_content1");


dt_bav_btn1.addEventListener("mouseover",function(){
    dt_bav_content1.style.display = "block";
});

dt_bav_btn1.addEventListener("mouseleave",function(){
    dt_bav_content1.style.display = "none";
});

dt_bav_content1.addEventListener("mouseover",function(){
    dt_bav_content1.style.display = "block";
});

dt_bav_content1.addEventListener("mouseleave",function(){
    dt_bav_content1.style.display = "none";
});



var dt_bav_btn2 = document.querySelector("#dt_nav_btn2");
var dt_bav_content2 = document.querySelector("#dt_nav_content2");


dt_bav_btn2.addEventListener("mouseover",function(){
    dt_bav_content2.style.display = "block";
});

dt_bav_btn2.addEventListener("mouseleave",function(){
    dt_bav_content2.style.display = "none";
});

dt_bav_content2.addEventListener("mouseover",function(){
    dt_bav_content2.style.display = "block";
});

dt_bav_content2.addEventListener("mouseleave",function(){
    dt_bav_content2.style.display = "none";
});


var dt_bav_btn3 = document.querySelector("#dt_nav_btn3");
var dt_bav_content3 = document.querySelector("#dt_nav_content3");


dt_bav_btn3.addEventListener("mouseover",function(){
    dt_bav_content3.style.display = "block";
});

dt_bav_btn3.addEventListener("mouseleave",function(){
    dt_bav_content3.style.display = "none";
});

dt_bav_content3.addEventListener("mouseover",function(){
    dt_bav_content3.style.display = "block";
});

dt_bav_content3.addEventListener("mouseleave",function(){
    dt_bav_content3.style.display = "none";
});



var dt_bav_btn4 = document.querySelector("#dt_nav_btn4");
var dt_bav_content4 = document.querySelector("#dt_nav_content4");


dt_bav_btn4.addEventListener("mouseover",function(){
    dt_bav_content4.style.display = "block";
});

dt_bav_btn4.addEventListener("mouseleave",function(){
    dt_bav_content4.style.display = "none";
});

dt_bav_content4.addEventListener("mouseover",function(){
    dt_bav_content4.style.display = "block";
});

dt_bav_content4.addEventListener("mouseleave",function(){
    dt_bav_content4.style.display = "none";
});



var dt_bav_btn5 = document.querySelector("#dt_nav_btn5");
var dt_bav_content5 = document.querySelector("#dt_nav_content5");


dt_bav_btn5.addEventListener("mouseover",function(){
    dt_bav_content5.style.display = "block";
});

dt_bav_btn5.addEventListener("mouseleave",function(){
    dt_bav_content5.style.display = "none";
});

dt_bav_content5.addEventListener("mouseover",function(){
    dt_bav_content5.style.display = "block";
});

dt_bav_content5.addEventListener("mouseleave",function(){
    dt_bav_content5.style.display = "none";
});


//导航按钮
var b = document.querySelector(".t");
var b1 = document.querySelector(".t1");
var d = document.querySelector(".nav-1");
var d1 = document.querySelector(".nav-1");

b.addEventListener("click",function(){
    b.style.display="block";
    d.style.display = "block";
    b1.style.display="block";
    b.style.display="none";

});
b1.addEventListener("click",function(){
    d1.style.display = "none";
    b.style.display = "block";
    b1.style.display="none";

});





//选项卡
var nav =document.querySelectorAll(".m > a");
var main =document.querySelectorAll(".main-3 > div");


for(var i = 0;i<nav.length; i++){
    nav[i].index = i;
    nav[i].addEventListener('click',function(){
        for(var j=0 ;j<nav.length; j++){
            nav[j].classList.remove('active');
            main[j].classList.remove('active');
        }
        console.log(this);
        console.log(this.index);
        this.classList.add('active');
        main[this.index].classList.add('active');
    })
}






var nav_1 =document.querySelectorAll(".m1 > a");
var main_1 =document.querySelectorAll(".main-5 > div");


for(var g = 0;g<nav_1.length; g++){
    nav_1[g].index = g;
    nav_1[g].addEventListener('click',function(){
        for(var j=0 ;j<nav_1.length; j++){
            nav_1[j].classList.remove('active');
            main_1[j].classList.remove('active');
        }
        console.log(this);
        console.log(this.index);
        this.classList.add('active');
        main_1[this.index].classList.add('active');
    })
}





//banner轮播
var mySwiper = new Swiper ('#banner #swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,  //自动播放
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    // 如果需要前进后退按钮
    navigation: {
        nextEl: '#banner #swiper-button-next',
        prevEl: '#banner #swiper-button-prev',
    }
});






//footer的悬停事件
var dt_bav_btn11 = document.querySelector("#dt_nav_btn11");
var dt_bav_content11 = document.querySelector("#dt_nav_content11");


dt_bav_btn11.addEventListener("mouseover",function(){
    dt_bav_content11.style.display = "block";
});

dt_bav_btn11.addEventListener("mouseleave",function(){
    dt_bav_content11.style.display = "none";
});

dt_bav_content11.addEventListener("mouseover",function(){
    dt_bav_content11.style.display = "block";
});

dt_bav_content11.addEventListener("mouseleave",function(){
    dt_bav_content11.style.display = "none";
});


//返回顶部
var toTop = document.querySelector("#toTop");

window.onscroll = function(){
    console.log(document.documentElement.scrollTop || document.body.scrollTop);
    if(document.documentElement.scrollTop > 100 || document.body.scrollTop){
        toTop.style.display = 'block';
    }else{
        toTop.style.display = 'none';
    }
    toTop.addEventListener('click',function(){
        //window.scrollTo(0,0);

        window.scrollTo({
            top:0,
            behavior:'smooth'

        })
    })

};
